<script setup>
import { onMounted,ref,reactive } from 'vue'
import {UserService} from '../../http/api'
onMounted(()=> {
    login4()
    // load()
})
let arr = ref([])
const login4 = async () => {
  const loginParams = {
    page: 1,
    per_page: 100
  }
  const res = await UserService.login4(loginParams)
  console.log(res)
  arr.value = res.data
  list.value = res.data
  finished.value = true;
  loading.value = false;
}

const list = ref([]);
const loading = ref(false);
const finished = ref(false);
const load = () => {
    // 异步更新数据
    // setTimeout 仅做示例，真实场景中一般为 ajax 请求
    // setTimeout(() => {
    //     for (let i = 0; i < 10; i++) {
    //         list.value.push(list.value.length + 1);
    //     }

    //     // 加载状态结束
    //     loading.value = false;

    //     // 数据全部加载完成
    //     if (list.value.length >= 40) {
    //         finished.value = true;
    //     }
    // }, 1000);
};
const activeNames = ref(['1']);
</script>

<template>
   <!-- <van-list
        v-model:loading="loading"
        :finished="finished"
        finished-text="没有更多了"
        @load="load"
        > -->
    <!-- <van-list @load="load">
        <van-cell v-for="item in list" :key="item._id" :title="item.username" />
    </van-list> -->
    <van-collapse v-model="activeNames">
        <van-collapse-item  v-for="(item,index) in list" :key="item._id" :title="item.username" :name="index" icon="shop-o">
            技术无非就是那些开发它的人的共同灵魂。
        </van-collapse-item>
    </van-collapse>
</template>

<style scoped>

</style>
